package com.module.circle.ui.createCircle

import androidx.lifecycle.LiveData
import com.common.app.data.bean.UpFileModel
import com.common.app.data.bean.circle.CircleListModel
import com.common.app.data.repository.CircleApi
import com.common.app.data.repository.UserApi
import com.common.base.app.viewmodel.BaseViewModel
import com.common.base.app.viewmodel.Cancel
import com.common.base.data.CommonBean
import com.common.base.data.ListCommon
import com.common.base.utils.AppUtils.getString
import com.module.circle.R
import java.io.File

/**
 *
 * 作者：sosou
 *
 * 版本：1.0
 *
 * 创建日期：2025/07/23
 *
 * 描述：创建圈子ViewModel
 *
 * 修订历史：
 *
 */
class CreateCircleViewModel : BaseViewModel() {

    fun uploadImage(url: File, type:String): LiveData<CommonBean<UpFileModel>> =
        emit({ showErrorToast(it.message ?: getString(R.string.common_upload_failed_hint)) }) {
            UserApi.uploadHeadImage(url,type)
        }

    fun requestCreateCircles(id:Int,name:String,imgId:Long,isPublic:Boolean = false,location:String,description:String,error: Cancel): LiveData<CommonBean<Any>> = emit(error) {
        CircleApi.requestCreateCircles(id, name, imgId,isPublic,location,description)
    }

}